<?php #//v.3.3.0
#///////////////////////////////////////////////////////
#//  COPYRIGHT 2004 Phpauction.org ALL RIGHTS RESERVED//
#///////////////////////////////////////////////////////

require('./includes/config.inc.php');
  
      set_time_limit(10);  
                   
// Get Auction ID

$auction_id = $_GET['id']; 

$id2 = $_SESSION["PHPAUCTION_LOGGED_IN"];
 
 if($id2) {
 
  $query = mysql_fetch_array(mysql_query("SELECT bids_remaining FROM PHPAUCTIONXL_users WHERE id=$id2 "));
  
  $jsenddate = " ";
  $jsenddate .= "|";
  $jsenddate .= $query['bids_remaining'];
   
  }
         if(!$id2) {
  
  $jsenddate = " ";   
  $jsenddate .= "|";
    $jsenddate .= "A";
  
  }
  
$jsenddate .= "|";
  
// Create DATE & TIME

$TIME = mktime(date("H")+$SETTINGS['timecorrection'],date("i"),date("s"),date("m"), date("d"),date("Y"));

$NOW = date("YmdHis",$TIME);


$jsenddate .= substr ($NOW, 4, 2);
$jsenddate .= "/";
$jsenddate .= substr ($NOW, 6, 2);
$jsenddate .= "/";
$jsenddate .= substr ($NOW, 0, 4);
$jsenddate .= " ";



     
if (substr ($NOW, 8, 2) > 12) {
$jsenddate .= substr ($NOW, 8, 2)-12;
$jsampm = "PM";
}
if (substr ($NOW, 8, 2) != 00){
if (substr ($NOW, 8, 2) < 12) {
$jsenddate .= substr ($NOW, 8, 2);
$jsampm = "AM";
}}
if (substr ($NOW, 8, 2) == 12) {
$jsenddate .= substr ($NOW, 8, 2);
$jsampm = "PM";
}
if (substr ($NOW, 8, 2) == 00) {
$jsenddate .= 12;
$jsampm = "AM";
}



$jsenddate .= ":";
$jsenddate .= substr ($NOW, 10, 2);
$jsenddate .= ":";
$jsenddate .= substr ($NOW, 12, 2);
$jsenddate .= " ";
$jsenddate .= $jsampm;
$jsenddate .= "|";


//GET END TIME



 
  $query = mysql_fetch_array(mysql_query("SELECT ends,starts,reserve_price FROM PHPAUCTIONXL_auctions WHERE id=$auction_id "));
  
  $reserve_price2 = $query['reserve_price'];
 $end_time = $query['ends'];
  $start_time = $query['starts'];
  
  if ( $start_time < $NOW ) {
  
$jsenddate .= substr ($end_time, 4, 2);
$jsenddate .= "/";
$jsenddate .= substr ($end_time, 6, 2);
$jsenddate .= "/";
$jsenddate .= substr ($end_time, 0, 4);
$jsenddate .= " ";



     
if (substr ($end_time, 8, 2) > 12) {
$jsenddate .= substr ($end_time, 8, 2)-12;
$jsampm = "PM";
}
if (substr ($end_time, 8, 2) != 00){
if (substr ($end_time, 8, 2) < 12) {
$jsenddate .= substr ($end_time, 8, 2);
$jsampm = "AM";
}}
if (substr ($end_time, 8, 2) == 12) {
$jsenddate .= substr ($end_time, 8, 2);
$jsampm = "PM";
}
if (substr ($end_time, 8, 2) == 00) {
$jsenddate .= 12;
$jsampm = "AM";
}



$jsenddate .= ":";
$jsenddate .= substr ($end_time, 10, 2);
$jsenddate .= ":";
$jsenddate .= substr ($end_time, 12, 2);
$jsenddate .= " ";
$jsenddate .= $jsampm;
$jsenddate .= "|";
           
             }
           
          if ( $start_time > $NOW ) {
  
$jsenddate .= substr ($start_time, 4, 2);
$jsenddate .= "/";
$jsenddate .= substr ($start_time, 6, 2);
$jsenddate .= "/";
$jsenddate .= substr ($start_time, 0, 4);
$jsenddate .= " ";



     
if (substr ($end_time, 8, 2) > 12) {
$jsenddate .= substr ($start_time, 8, 2)-12;
$jsampm = "PM";
}
if (substr ($end_time, 8, 2) != 00){
if (substr ($end_time, 8, 2) < 12) {
$jsenddate .= substr ($start_time, 8, 2);
$jsampm = "AM";
}}
if (substr ($end_time, 8, 2) == 12) {
$jsenddate .= substr ($start_time, 8, 2);
$jsampm = "PM";
}
if (substr ($end_time, 8, 2) == 00) {
$jsenddate .= 12;
$jsampm = "AM";
}



$jsenddate .= ":";
$jsenddate .= substr ($start_time, 10, 2);
$jsenddate .= ":";
$jsenddate .= substr ($start_time, 12, 2);
$jsenddate .= " ";
$jsenddate .= $jsampm;
$jsenddate .= "|";
           
             }   
           
           
 $jsenddate .= $reserve_price2;
$jsenddate .= "|";


// GET COUNTER

$query = "SELECT counter as counter from PHPAUCTIONXL_auccounter where auction_id=$auction_id";
$result = mysql_query($query);
$num_auction = mysql_num_rows($result);

 $i = 0;
while($i < $num_auction) {

  $counter = mysql_result($result,$i,"counter");

$jsenddate .= $counter;
$jsenddate .= "|";

$i++;
}





// GET HIGH BIDDER INFO

$query = "select current_high_bidder,current_bid from PHPAUCTIONXL_auctions
         WHERE id=$auction_id";
$result = mysql_query($query);
$num_auction = mysql_num_rows($result);

 $i = 0;
while($i < $num_auction) {

  $high_bidder 	= mysql_result($result,$i,"current_high_bidder");
$high_bid 	= mysql_result($result,$i,"current_bid");


$jsenddate .= $high_bidder;
$jsenddate .= "|";
$jsenddate .= print_money_nosymbol($high_bid);
$jsenddate .= "|";

$i++;
}

// GET # of BIDS

$query = "select * from PHPAUCTIONXL_bids where auction = $auction_id ORDER BY id";
$result_numbids = mysql_query ($query);
$number_of_bids = mysql_num_rows($result_numbids);

$jsenddate .= $number_of_bids;
$jsenddate .= "|";


// GET BID HISTORY

$query = "select * from PHPAUCTIONXL_bids where auction = $auction_id ORDER BY id DESC LIMIT 0,5";
$result_numbids = mysql_query ($query);
$num_auction2 = mysql_num_rows($result_numbids);

 $ii = 0;
while($ii < $num_auction2) {

  $high_bidder 	= mysql_result($result_numbids,$ii,"current_high_bidder");
$high_bid 	= mysql_result($result_numbids,$ii,"bid");
$ends = mysql_result($result_numbids,$ii,"bidwhen");

$jsenddate .= $high_bidder;
$jsenddate .= "|";
$jsenddate .= print_money_nosymbol($high_bid);
$jsenddate .= "|";
$jsenddate .= substr ($ends, 4, 2);
$jsenddate .= "/";
$jsenddate .= substr ($ends, 6, 2);
$jsenddate .= "/";
$jsenddate .= substr ($ends, 2, 2);
$jsenddate .= " ";



if (substr ($ends, 8, 2) > 12) {
$jsenddate .= substr ($ends, 8, 2)-12;
$jsampm = "PM";
}
if (substr ($ends, 8, 2) != 00) {
if (substr ($ends, 8, 2) < 12) {
$jsenddate .= substr ($ends, 8, 2);
$jsampm = "AM";
}
}
if (substr ($ends, 8, 2) == 12) {
$jsenddate .= substr ($ends, 8, 2);
$jsampm = "PM";
}
if (substr ($ends, 8, 2) == 00) {
$jsenddate .= substr ($ends, 8, 2);
$jsampm = "AM";
}


$jsenddate .= ":";
$jsenddate .= substr ($ends, 10, 2);
$jsenddate .= ":";
$jsenddate .= substr ($ends, 12, 2);
$jsenddate .= " ";
$jsenddate .= $jsampm;
$jsenddate .= "|";
$ii++;

}

    if( $num_auction2 < 1 ){
    
$jsenddate .= "--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|";    
    }

      if( $num_auction2 < 2 ){
    
$jsenddate .= "--|--|--|--|--|--|--|--|--|--|--|--|";    
    }
    
       if( $num_auction2 < 3 ){
    
$jsenddate .= "--|--|--|--|--|--|--|--|--|";    
    }


           if( $num_auction2 < 4 ){
    
$jsenddate .= "--|--|--|--|--|--|";    
    }
    
            if( $num_auction2 < 5 ){
    
$jsenddate .= "--|--|--|";    
    }  
    
    
   $query_settings = "select * from PHPAUCTIONXL_proxybid_settings where id='1'";
                             $query_settings2a =  mysql_query ($query_settings);
                                $activated = mysql_result($query_settings2a,0,"activated");
                                
                                 
        if ( $activated == 1 ) {
    if ( $_SESSION["PHPAUCTION_LOGGED_IN"] ) {
 
 
  $query444 = mysql_fetch_array(mysql_query("SELECT proxybidqty FROM PHPAUCTIONXL_proxybid WHERE itemid=$auction_id AND userid=$id2 "));
  

 $autobidder_bids_remaining = $query444['proxybidqty'];
 
 $jsenddate .= $autobidder_bids_remaining;
  
 }
       if ( !$_SESSION["PHPAUCTION_LOGGED_IN"] ) {
             $jsenddate .= login;  
       }
       
  } 
       if ( $activated == 0 ) {
       
       
                  $jsenddate .= login; 
    
             }
             
           
echo $jsenddate;



              if ( $activated == 1 ) {
include 'autobidder2.php';
                 }



$query_settings2 = "select * from PHPAUCTIONXL_unique_settings where id='1'";
                             $query_settings3 =  mysql_query ($query_settings2);
                                $activated2 = mysql_result($query_settings3,0,"activated");
        if ( $activated2 == 1 ) {
include 'unique.php';
      }



            
           
function shutdown () {
    // print only first 2000 characters of output

ob_get_clean();
    
}

register_shutdown_function('shutdown');


?>





